home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / compack6 / dacpack6.exe / DGroup.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1998-10-13  |  13.7 KB  |  492 lines

  1. VERSION 5.00
  2. Object = "{5B494162-D2D9-11D1-A7C6-00C04FA30EBD}#1.0#0"; "DGroup.dll"
  3. Begin VB.Form Form1 
  4.    Caption         =   "DameWare Group Control Sample"
  5.    ClientHeight    =   6420
  6.    ClientLeft      =   5055
  7.    ClientTop       =   2940
  8.    ClientWidth     =   7635
  9.    LinkTopic       =   "Form1"
  10.    ScaleHeight     =   6420
  11.    ScaleWidth      =   7635
  12.    StartUpPosition =   2  'CenterScreen
  13.    Begin VB.CommandButton Command12 
  14.       Caption         =   "Get Local Machine"
  15.       Height          =   375
  16.       Left            =   4080
  17.       TabIndex        =   7
  18.       Top             =   360
  19.       Width           =   1575
  20.    End
  21.    Begin VB.TextBox Text6 
  22.       Height          =   405
  23.       Left            =   240
  24.       TabIndex        =   4
  25.       Text            =   "Text6"
  26.       Top             =   3240
  27.       Width           =   2055
  28.    End
  29.    Begin VB.ListBox List1 
  30.       Height          =   1815
  31.       Left            =   240
  32.       Sorted          =   -1  'True
  33.       TabIndex        =   18
  34.       Top             =   4440
  35.       Width           =   7215
  36.    End
  37.    Begin VB.CommandButton Command11 
  38.       Caption         =   "Disconnect"
  39.       Height          =   375
  40.       Left            =   2400
  41.       TabIndex        =   17
  42.       Top             =   3960
  43.       Width           =   1575
  44.    End
  45.    Begin VB.TextBox Text5 
  46.       Height          =   375
  47.       Left            =   240
  48.       TabIndex        =   3
  49.       Text            =   "Text5"
  50.       Top             =   2520
  51.       Width           =   2055
  52.    End
  53.    Begin VB.CommandButton Command10 
  54.       Caption         =   "Get Current User"
  55.       Height          =   375
  56.       Left            =   5760
  57.       TabIndex        =   10
  58.       Top             =   1080
  59.       Width           =   1575
  60.    End
  61.    Begin VB.CommandButton Command9 
  62.       Caption         =   "Remove Member"
  63.       Height          =   375
  64.       Left            =   4080
  65.       TabIndex        =   15
  66.       Top             =   2520
  67.       Width           =   1575
  68.    End
  69.    Begin VB.CommandButton Command8 
  70.       Caption         =   "Add Member"
  71.       Height          =   375
  72.       Left            =   2400
  73.       TabIndex        =   14
  74.       Top             =   2520
  75.       Width           =   1575
  76.    End
  77.    Begin VB.CommandButton Command7 
  78.       Caption         =   "Connect"
  79.       Height          =   375
  80.       Left            =   2400
  81.       TabIndex        =   16
  82.       Top             =   3240
  83.       Width           =   1575
  84.    End
  85.    Begin VB.TextBox Text4 
  86.       Height          =   375
  87.       Left            =   240
  88.       TabIndex        =   5
  89.       Text            =   "Text4"
  90.       Top             =   3960
  91.       Width           =   2055
  92.    End
  93.    Begin VB.CommandButton Command6 
  94.       Caption         =   "Delete Group"
  95.       Height          =   375
  96.       Left            =   5760
  97.       TabIndex        =   13
  98.       Top             =   1800
  99.       Width           =   1575
  100.    End
  101.    Begin VB.CommandButton Command5 
  102.       Caption         =   "Add Group"
  103.       Height          =   375
  104.       Left            =   4080
  105.       TabIndex        =   12
  106.       Top             =   1800
  107.       Width           =   1575
  108.    End
  109.    Begin VB.CommandButton Command4 
  110.       Caption         =   "IsMember"
  111.       Height          =   375
  112.       Left            =   4080
  113.       TabIndex        =   9
  114.       Top             =   1080
  115.       Width           =   1575
  116.    End
  117.    Begin VB.CommandButton Command3 
  118.       Caption         =   "Get Group Users"
  119.       Height          =   375
  120.       Left            =   2400
  121.       TabIndex        =   11
  122.       Top             =   1800
  123.       Width           =   1575
  124.    End
  125.    Begin VB.TextBox Text3 
  126.       Height          =   375
  127.       Left            =   240
  128.       TabIndex        =   2
  129.       Text            =   "Text3"
  130.       Top             =   1800
  131.       Width           =   2055
  132.    End
  133.    Begin VB.CommandButton Command2 
  134.       Caption         =   "Get User Groups"
  135.       Height          =   375
  136.       Left            =   2400
  137.       TabIndex        =   8
  138.       Top             =   1080
  139.       Width           =   1575
  140.    End
  141.    Begin VB.CommandButton Command1 
  142.       Caption         =   "Get All Groups"
  143.       Default         =   -1  'True
  144.       Height          =   375
  145.       Left            =   2400
  146.       TabIndex        =   6
  147.       Top             =   360
  148.       Width           =   1575
  149.    End
  150.    Begin VB.TextBox Text2 
  151.       Height          =   375
  152.       Left            =   240
  153.       TabIndex        =   1
  154.       Text            =   "Text2"
  155.       Top             =   1080
  156.       Width           =   2055
  157.    End
  158.    Begin VB.TextBox Text1 
  159.       Height          =   375
  160.       Left            =   240
  161.       TabIndex        =   0
  162.       Text            =   "Text1"
  163.       Top             =   360
  164.       Width           =   2055
  165.    End
  166.    Begin VB.Shape Shape1 
  167.       BackStyle       =   1  'Opaque
  168.       FillColor       =   &H00FFFFFF&
  169.       FillStyle       =   0  'Solid
  170.       Height          =   375
  171.       Left            =   6000
  172.       Shape           =   3  'Circle
  173.       Top             =   360
  174.       Width           =   495
  175.    End
  176.    Begin VB.Label Label7 
  177.       Caption         =   "Connect UserID"
  178.       Height          =   255
  179.       Left            =   240
  180.       TabIndex        =   26
  181.       Top             =   3000
  182.       Width           =   2055
  183.    End
  184.    Begin VB.Label Label6 
  185.       Alignment       =   1  'Right Justify
  186.       Caption         =   "Label6"
  187.       Height          =   255
  188.       Left            =   5880
  189.       TabIndex        =   25
  190.       Top             =   3960
  191.       Width           =   1575
  192.    End
  193.    Begin DGROUPLibCtl.DGroupCtl DGroupCtl1 
  194.       Height          =   480
  195.       Left            =   7080
  196.       TabIndex        =   24
  197.       Top             =   120
  198.       Width           =   480
  199.       _cx             =   5080
  200.       _cy             =   5080
  201.       Valid           =   -1  'True
  202.       UserID          =   ""
  203.       Group           =   ""
  204.       Domain          =   ""
  205.       GroupComment    =   ""
  206.       ConnectUserID   =   ""
  207.       ConnectPassword =   ""
  208.    End
  209.    Begin VB.Label Label5 
  210.       Caption         =   "Group Comment"
  211.       Height          =   255
  212.       Left            =   240
  213.       TabIndex        =   23
  214.       Top             =   2280
  215.       Width           =   2055
  216.    End
  217.    Begin VB.Label Label4 
  218.       Caption         =   "Connect Password"
  219.       Height          =   255
  220.       Left            =   240
  221.       TabIndex        =   22
  222.       Top             =   3720
  223.       Width           =   2055
  224.    End
  225.    Begin VB.Label Label3 
  226.       Caption         =   "Group"
  227.       Height          =   255
  228.       Left            =   240
  229.       TabIndex        =   21
  230.       Top             =   1560
  231.       Width           =   2055
  232.    End
  233.    Begin VB.Label Label2 
  234.       Caption         =   "User ID"
  235.       Height          =   255
  236.       Left            =   240
  237.       TabIndex        =   20
  238.       Top             =   840
  239.       Width           =   1935
  240.    End
  241.    Begin VB.Label Label1 
  242.       Caption         =   "Domain or Machine Name"
  243.       Height          =   255
  244.       Left            =   240
  245.       TabIndex        =   19
  246.       Top             =   120
  247.       Width           =   2055
  248.    End
  249. Attribute VB_Name = "Form1"
  250. Attribute VB_GlobalNameSpace = False
  251. Attribute VB_Creatable = False
  252. Attribute VB_PredeclaredId = True
  253. Attribute VB_Exposed = False
  254. Private Sub Check1_Click()
  255. On Error GoTo ErrorHandler
  256. Exit Sub
  257. ErrorHandler:
  258.     OnErrorHandler
  259.     'Resume Next
  260. End Sub
  261. Private Sub Command1_Click()
  262. On Error GoTo ErrorHandler
  263. List1.Clear
  264. Shape1.FillColor = &H80FFFF    'yellow busy
  265. Shape1.Refresh
  266. DGroupCtl1.Domain = Text1.Text
  267. DGroupCtl1.SetFirstGroup
  268. i = 0
  269. While DGroupCtl1.GroupGetNext <> 0
  270.     List1.AddItem DGroupCtl1.Group + Chr(9) + DGroupCtl1.GroupComment
  271.     i = i + 1
  272.     Label6.Caption = "Count: " + Str(i)
  273.     Label6.Refresh
  274. Shape1.FillColor = &H80FF80 ' green - returned ok
  275. Shape1.Refresh
  276. Exit Sub
  277. ErrorHandler:
  278.     OnErrorHandler
  279. Shape1.FillColor = &HFF&       ' red - failed
  280. Shape1.Refresh
  281.     'Resume Next
  282. End Sub
  283. Private Sub Command10_Click()
  284. On Error GoTo ErrorHandler
  285. Shape1.FillColor = &H80FFFF    'yellow busy
  286. Shape1.Refresh
  287. Text2.Text = DGroupCtl1.GetCurrentUserID
  288. Shape1.FillColor = &H80FF80 ' green - returned ok
  289. Shape1.Refresh
  290. Exit Sub
  291. ErrorHandler:
  292.     OnErrorHandler
  293.     'Resume Next
  294. Shape1.FillColor = &HFF&       ' red - failed
  295. Shape1.Refresh
  296. End Sub
  297. Private Sub Command11_Click()
  298. On Error GoTo ErrorHandler
  299. Shape1.FillColor = &H80FFFF    'yellow busy
  300. Shape1.Refresh
  301. DGroupCtl1.Domain = Text1.Text
  302. DGroupCtl1.UserDisconnect
  303. Shape1.FillColor = &H80FF80 ' green - returned ok
  304. Shape1.Refresh
  305. Exit Sub
  306. ErrorHandler:
  307.     OnErrorHandler
  308.     'Resume Next
  309. Shape1.FillColor = &HFF&       ' red - failed
  310. Shape1.Refresh
  311. End Sub
  312. Private Sub Command12_Click()
  313. Shape1.FillColor = &H80FFFF    'yellow busy
  314. Shape1.Refresh
  315. Text1.Text = DGroupCtl1.GetLocalMachineName
  316. Shape1.FillColor = &H80FF80 ' green - returned ok
  317. Shape1.Refresh
  318. End Sub
  319. Private Sub Command2_Click()
  320. On Error GoTo ErrorHandler
  321. Dim Count As Long
  322. List1.Clear
  323. Shape1.FillColor = &H80FFFF    'yellow busy
  324. Shape1.Refresh
  325. DGroupCtl1.Domain = Text1.Text
  326. DGroupCtl1.UserID = Text2.Text
  327. DGroupCtl1.SetFirstUserGroup
  328. i = 0
  329. While DGroupCtl1.UserGroupGetNext <> 0
  330.     List1.AddItem DGroupCtl1.Group
  331.     i = i + 1
  332.     Label6.Caption = "Count: " + Str(i)
  333.     Label6.Refresh
  334. Shape1.FillColor = &H80FF80 ' green - returned ok
  335. Shape1.Refresh
  336. Exit Sub
  337. ErrorHandler:
  338.     OnErrorHandler
  339.     'Resume Next
  340. Shape1.FillColor = &HFF&       ' red - failed
  341. Shape1.Refresh
  342. End Sub
  343. Private Sub Command3_Click()
  344. On Error GoTo ErrorHandler
  345. List1.Clear
  346. Shape1.FillColor = &H80FFFF    'yellow busy
  347. Shape1.Refresh
  348. DGroupCtl1.Domain = Text1.Text
  349. DGroupCtl1.Group = Text3.Text
  350. DGroupCtl1.SetFirstUser
  351. i = 0
  352. While DGroupCtl1.UserGetNext <> 0
  353.     List1.AddItem DGroupCtl1.UserID
  354.     i = i + 1
  355.     Label6.Caption = "Count: " + Str(i)
  356.     Label6.Refresh
  357. Shape1.FillColor = &H80FF80 ' green - returned ok
  358. Shape1.Refresh
  359. Exit Sub
  360. ErrorHandler:
  361.     OnErrorHandler
  362.     'Resume Next
  363. Shape1.FillColor = &HFF&       ' red - failed
  364. Shape1.Refresh
  365. End Sub
  366. Private Sub Command4_Click()
  367. On Error GoTo ErrorHandler
  368. Shape1.FillColor = &H80FFFF    'yellow busy
  369. Shape1.Refresh
  370. Form1.Refresh
  371. DGroupCtl1.Domain = Text1.Text
  372. DGroupCtl1.UserID = Text2.Text
  373. DGroupCtl1.Group = Text3.Text
  374. If DGroupCtl1.IsMember = False Then
  375.     MsgBox "User " + DGroupCtl1.UserID + " Is NOT Member of group " + Text3.Text
  376.     MsgBox "User " + DGroupCtl1.UserID + " Is Member of group " + Text3.Text
  377. End If
  378. Shape1.FillColor = &H80FF80 ' green - returned ok
  379. Shape1.Refresh
  380. Exit Sub
  381. ErrorHandler:
  382.     OnErrorHandler
  383.     'Resume Next
  384. Shape1.FillColor = &HFF&       ' red - failed
  385. Shape1.Refresh
  386. End Sub
  387. Private Sub Command5_Click()
  388. On Error GoTo ErrorHandler
  389. Shape1.FillColor = &H80FFFF    'yellow busy
  390. Shape1.Refresh
  391. DGroupCtl1.Domain = Text1.Text
  392. DGroupCtl1.Group = Text3.Text
  393. DGroupCtl1.GroupComment = Text5.Text
  394. DGroupCtl1.GroupAdd
  395. Shape1.FillColor = &H80FF80 ' green - returned ok
  396. Shape1.Refresh
  397. Exit Sub
  398. ErrorHandler:
  399.     OnErrorHandler
  400.     'Resume Next
  401. Shape1.FillColor = &HFF&       ' red - failed
  402. Shape1.Refresh
  403. End Sub
  404. Private Sub Command6_Click()
  405. On Error GoTo ErrorHandler
  406. Shape1.FillColor = &H80FFFF    'yellow busy
  407. Shape1.Refresh
  408. DGroupCtl1.Domain = Text1.Text
  409. DGroupCtl1.Group = Text3.Text
  410. DGroupCtl1.GroupDelete
  411. Shape1.FillColor = &H80FF80 ' green - returned ok
  412. Shape1.Refresh
  413. Exit Sub
  414. ErrorHandler:
  415.     OnErrorHandler
  416.     'Resume Next
  417. Shape1.FillColor = &HFF&       ' red - failed
  418. Shape1.Refresh
  419. End Sub
  420. Private Sub Command7_Click()
  421. On Error GoTo ErrorHandler
  422. Shape1.FillColor = &H80FFFF    'yellow busy
  423. Shape1.Refresh
  424. DGroupCtl1.Domain = Text1.Text
  425. DGroupCtl1.ConnectUserID = Text6.Text
  426. DGroupCtl1.ConnectPassword = Text4.Text
  427. DGroupCtl1.UserConnect
  428. Shape1.FillColor = &H80FF80 ' green - returned ok
  429. Shape1.Refresh
  430. Exit Sub
  431. ErrorHandler:
  432.     OnErrorHandler
  433.     'Resume Next
  434. Shape1.FillColor = &HFF&       ' red - failed
  435. Shape1.Refresh
  436. End Sub
  437. Private Sub Command8_Click()
  438. On Error GoTo ErrorHandler
  439. Shape1.FillColor = &H80FFFF    'yellow busy
  440. Shape1.Refresh
  441. DGroupCtl1.Domain = Text1.Text
  442. DGroupCtl1.UserID = Text2.Text
  443. DGroupCtl1.Group = Text3.Text
  444. DGroupCtl1.GroupAddMember
  445. Shape1.FillColor = &H80FF80 ' green - returned ok
  446. Shape1.Refresh
  447. Exit Sub
  448. ErrorHandler:
  449.     OnErrorHandler
  450.     'Resume Next
  451. Shape1.FillColor = &HFF&       ' red - failed
  452. Shape1.Refresh
  453. End Sub
  454. Private Sub Command9_Click()
  455. On Error GoTo ErrorHandler
  456. Shape1.FillColor = &H80FFFF    'yellow busy
  457. Shape1.Refresh
  458. DGroupCtl1.Domain = Text1.Text
  459. DGroupCtl1.UserID = Text2.Text
  460. DGroupCtl1.Group = Text3.Text
  461. DGroupCtl1.GroupRemoveMember
  462. Shape1.FillColor = &H80FF80 ' green - returned ok
  463. Shape1.Refresh
  464. Exit Sub
  465. ErrorHandler:
  466.     OnErrorHandler
  467.     'Resume Next
  468. Shape1.FillColor = &HFF&       ' red - failed
  469. Shape1.Refresh
  470. End Sub
  471. Private Sub Form_Load()
  472. On Error GoTo ErrorHandler
  473. Text1.Text = DGroupCtl1.GetLocalMachineName
  474. Text2.Text = DGroupCtl1.GetCurrentUserID
  475. Text3.Text = ""
  476. Text4.Text = ""
  477. Text5.Text = ""
  478. Text6.Text = DGroupCtl1.GetCurrentUserID
  479. Label6.Caption = "Count:    "
  480. Shape1.FillColor = &H80FF80 ' green - returned ok
  481. Shape1.Refresh
  482. Exit Sub
  483. ErrorHandler:
  484.     OnErrorHandler
  485.     'Resume Next
  486. End Sub
  487. Sub OnErrorHandler()
  488. If Err.Number <> 0 Then
  489.     MsgBox Err.Description, , "Error"
  490. End If
  491. End Sub
  492.